<!DOCTYPE html>
<html lang=zh>
<head>
    <meta charset="utf-8">
    
    <title>Java7任务并行执行神器：Fork&amp;Join框架 | Java技术栈</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <meta name="description" content="Fork/Join是什么？Fork/Join框架是Java7提供的并行执行任务框架，思想是将大任务分解成小任务，然后小任务又可以继续分解，然后每个小任务分别计算出结果再合并起来，最后将汇总的结果作为大任务结果。其思想和MapReduce的思想非常类似。对于任务的分割，要求各个子任务之间相互独立，能够并行独立地执行任务，互相之间不影响。">
<meta name="keywords" content="Java,多线程,jdk7">
<meta property="og:type" content="article">
<meta property="og:title" content="Java7任务并行执行神器：Fork&amp;Join框架">
<meta property="og:url" content="http://youanyyou.gitee.io/javastack/2017/12/22/Java/thread/Java7任务并行执行神器：Fork&Join框架/index.html">
<meta property="og:site_name" content="Java技术栈">
<meta property="og:description" content="Fork/Join是什么？Fork/Join框架是Java7提供的并行执行任务框架，思想是将大任务分解成小任务，然后小任务又可以继续分解，然后每个小任务分别计算出结果再合并起来，最后将汇总的结果作为大任务结果。其思想和MapReduce的思想非常类似。对于任务的分割，要求各个子任务之间相互独立，能够并行独立地执行任务，互相之间不影响。">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="https://res.infoq.com/articles/fork-join-introduction/zh/resources/21.png">
<meta property="og:image" content="http://java.boot.by/ocpjp7-upgrade/images/040501.gif">
<meta property="og:image" content="https://res.infoq.com/articles/fork-join-introduction/zh/resources/image3.png">
<meta property="og:image" content="http://img.blog.csdn.net/20160720172854109">
<meta property="og:updated_time" content="2018-04-18T10:37:52.010Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Java7任务并行执行神器：Fork&amp;Join框架">
<meta name="twitter:description" content="Fork/Join是什么？Fork/Join框架是Java7提供的并行执行任务框架，思想是将大任务分解成小任务，然后小任务又可以继续分解，然后每个小任务分别计算出结果再合并起来，最后将汇总的结果作为大任务结果。其思想和MapReduce的思想非常类似。对于任务的分割，要求各个子任务之间相互独立，能够并行独立地执行任务，互相之间不影响。">
<meta name="twitter:image" content="https://res.infoq.com/articles/fork-join-introduction/zh/resources/21.png">
    

    
        <link rel="alternate" href="/" title="Java技术栈" type="application/atom+xml" />
    

    

    <link rel="stylesheet" href="/javastack/libs/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="/javastack/libs/open-sans/styles.css">
    <link rel="stylesheet" href="/javastack/libs/source-code-pro/styles.css">

    <link rel="stylesheet" href="/javastack/css/style.css">

    <script src="/javastack/libs/jquery/2.1.3/jquery.min.js"></script>
    
    
        <link rel="stylesheet" href="/javastack/libs/lightgallery/css/lightgallery.min.css">
    
    
        <link rel="stylesheet" href="/javastack/libs/justified-gallery/justifiedGallery.min.css">
    
    
    
    


</head>

<body>
    <div id="container">
        <header id="header">
    <div id="header-main" class="header-inner">
        <div class="outer">
            <a href="/javastack/" id="logo">
                <i class="logo"></i>
                <span class="site-title">Java技术栈</span>
            </a>
            <nav id="main-nav">
                
                    <a class="main-nav-link" href="/javastack/.">首页</a>
                
                    <a class="main-nav-link" href="/javastack/archives">归档</a>
                
                    <a class="main-nav-link" href="/javastack/categories">分类</a>
                
                    <a class="main-nav-link" href="/javastack/tags">标签</a>
                
                    <a class="main-nav-link" href="/javastack/about">关于</a>
                
            </nav>
            
                
                <nav id="sub-nav">
                    <div class="profile" id="profile-nav">
                        <a id="profile-anchor" href="javascript:;">
                            <img class="avatar" src="/javastack/css/images/avatar.jpg" />
                            <i class="fa fa-caret-down"></i>
                        </a>
                    </div>
                </nav>
            
            <div id="search-form-wrap">

    <form class="search-form">
        <input type="text" class="ins-search-input search-form-input" placeholder="搜索" />
        <button type="submit" class="search-form-submit"></button>
    </form>
    <div class="ins-search">
    <div class="ins-search-mask"></div>
    <div class="ins-search-container">
        <div class="ins-input-wrapper">
            <input type="text" class="ins-search-input" placeholder="想要查找什么..." />
            <span class="ins-close ins-selectable"><i class="fa fa-times-circle"></i></span>
        </div>
        <div class="ins-section-wrapper">
            <div class="ins-section-container"></div>
        </div>
    </div>
</div>
<script>
(function (window) {
    var INSIGHT_CONFIG = {
        TRANSLATION: {
            POSTS: '文章',
            PAGES: '页面',
            CATEGORIES: '分类',
            TAGS: '标签',
            UNTITLED: '(未命名)',
        },
        ROOT_URL: '/javastack/',
        CONTENT_URL: '/javastack/content.json',
    };
    window.INSIGHT_CONFIG = INSIGHT_CONFIG;
})(window);
</script>
<script src="/javastack/js/insight.js"></script>

</div>
        </div>
    </div>
    <div id="main-nav-mobile" class="header-sub header-inner">
        <table class="menu outer">
            <tr>
                
                    <td><a class="main-nav-link" href="/javastack/.">首页</a></td>
                
                    <td><a class="main-nav-link" href="/javastack/archives">归档</a></td>
                
                    <td><a class="main-nav-link" href="/javastack/categories">分类</a></td>
                
                    <td><a class="main-nav-link" href="/javastack/tags">标签</a></td>
                
                    <td><a class="main-nav-link" href="/javastack/about">关于</a></td>
                
                <td>
                    
    <div class="search-form">
        <input type="text" class="ins-search-input search-form-input" placeholder="搜索" />
    </div>

                </td>
            </tr>
        </table>
    </div>
</header>

        <div class="outer">
            
                

<aside id="profile">
    <div class="inner profile-inner">
        <div class="base-info profile-block">
            <img id="avatar" src="/javastack/css/images/avatar.jpg" />
            <h2 id="name">Java技术栈</h2><br/>
            <h3 id="title">微信公众号,每日更新！</h3>
            <!--
            <span id="location">
                <i class="fa fa-map-marker"></i>Shenzhen, China
            </span>
            -->
            <a id="follow" target="_blank" href="http://youanyyou.gitee.io/javastack/css/images/avatar.jpg">扫描关注微信公众号</a>
        </div>
        <div class="article-info profile-block">
            <div class="article-info-block">
                113
                <span>文章</span>
            </div>
            <div class="article-info-block">
                58
                <span>标签</span>
            </div>
        </div>
        
        <div class="profile-block social-links">
            <table>
                <tr>
                    
                    
                    <td>
                        <a href="http://github.com/ppoffice/hexo-theme-icarus" target="_blank" title="github" class=tooltip>
                            <i class="fa fa-github"></i>
                        </a>
                    </td>
                    
                    <td>
                        <a href="/javastack/" target="_blank" title="twitter" class=tooltip>
                            <i class="fa fa-twitter"></i>
                        </a>
                    </td>
                    
                    <td>
                        <a href="/javastack/" target="_blank" title="facebook" class=tooltip>
                            <i class="fa fa-facebook"></i>
                        </a>
                    </td>
                    
                    <td>
                        <a href="/javastack/" target="_blank" title="dribbble" class=tooltip>
                            <i class="fa fa-dribbble"></i>
                        </a>
                    </td>
                    
                    <td>
                        <a href="/javastack/" target="_blank" title="rss" class=tooltip>
                            <i class="fa fa-rss"></i>
                        </a>
                    </td>
                    
                </tr>
            </table>
        </div>
        
    </div>
</aside>

            
            <section id="main"><article id="post-Java/thread/Java7任务并行执行神器：Fork&amp;Join框架" class="article article-type-post" itemscope itemprop="blogPost">
    <div class="article-inner">
        
        
            <header class="article-header">
                
    
        <h1 class="article-title" itemprop="name">
            Java7任务并行执行神器：Fork&amp;Join框架
        </h1>
    

                
                    <div class="article-meta">
                        
    <div class="article-date">
        <i class="fa fa-calendar"></i>
        <a href="/javastack/2017/12/22/Java/thread/Java7任务并行执行神器：Fork&Join框架/">
            <time datetime="2017-12-21T16:00:00.000Z" itemprop="datePublished">2017-12-22</time>
        </a>
    </div>


                        
    <div class="article-category">
    	<i class="fa fa-folder"></i>
        <a class="article-category-link" href="/javastack/categories/Java/">Java</a><i class="fa fa-angle-right"></i><a class="article-category-link" href="/javastack/categories/Java/多线程/">多线程</a>
    </div>

                        
    <div class="article-tag">
        <i class="fa fa-tag"></i>
        <a class="tag-link" href="/javastack/tags/Java/">Java</a>, <a class="tag-link" href="/javastack/tags/jdk7/">jdk7</a>, <a class="tag-link" href="/javastack/tags/多线程/">多线程</a>
    </div>

                    </div>
                
            </header>
        
        
        <div class="article-entry" itemprop="articleBody">
        
            
            <h4 id="Fork-Join是什么？"><a href="#Fork-Join是什么？" class="headerlink" title="Fork/Join是什么？"></a>Fork/Join是什么？</h4><p>Fork/Join框架是Java7提供的并行执行任务框架，思想是将大任务分解成小任务，然后小任务又可以继续分解，然后每个小任务分别计算出结果再合并起来，最后将汇总的结果作为大任务结果。其思想和MapReduce的思想非常类似。对于任务的分割，要求各个子任务之间相互独立，能够并行独立地执行任务，互相之间不影响。</p>
<a id="more"></a>
<p><strong>Fork/Join的运行流程图如下：</strong></p>
<p><img src="https://res.infoq.com/articles/fork-join-introduction/zh/resources/21.png" alt="image"></p>
<p>我们可以通过Fork/Join单词字面上的意思去理解这个框架。Fork是叉子分叉的意思，即将大任务分解成并行的小任务，Join是连接结合的意思，即将所有并行的小任务的执行结果汇总起来。</p>
<p><img src="http://java.boot.by/ocpjp7-upgrade/images/040501.gif" alt="image"></p>
<h4 id="工作窃取算法"><a href="#工作窃取算法" class="headerlink" title="工作窃取算法"></a>工作窃取算法</h4><p>ForkJoin采用了工作窃取（work-stealing）算法，若一个工作线程的任务队列为空没有任务执行时，便从其他工作线程中获取任务主动执行。为了实现工作窃取，在工作线程中维护了双端队列，窃取任务线程从队尾获取任务，被窃取任务线程从队头获取任务。这种机制充分利用线程进行并行计算，减少了线程竞争。但是当队列中只存在一个任务了时，两个线程去取反而会造成资源浪费。</p>
<p><strong>工作窃取的运行流程图如下：</strong></p>
<p><img src="https://res.infoq.com/articles/fork-join-introduction/zh/resources/image3.png" alt="image"></p>
<h4 id="Fork-Join核心类"><a href="#Fork-Join核心类" class="headerlink" title="Fork/Join核心类"></a>Fork/Join核心类</h4><p>Fork/Join框架主要由子任务、任务调度两部分组成，类层次图如下。</p>
<p><img src="http://img.blog.csdn.net/20160720172854109" alt="image"></p>
<ul>
<li><strong>ForkJoinPool</strong></li>
</ul>
<p>ForkJoinPool是ForkJoin框架中的任务调度器，和ThreadPoolExecutor一样实现了自己的线程池，提供了三种调度子任务的方法：</p>
<ol>
<li>execute：异步执行指定任务，无返回结果；</li>
<li>invoke、invokeAll：异步执行指定任务，等待完成才返回结果；</li>
<li>submit：异步执行指定任务，并立即返回一个Future对象；</li>
</ol>
<ul>
<li><strong>ForkJoinTask</strong></li>
</ul>
<p>Fork/Join框架中的实际的执行任务类，有以下两种实现，一般继承这两种实现类即可。</p>
<ol>
<li>RecursiveAction：用于无结果返回的子任务；</li>
<li>RecursiveTask：用于有结果返回的子任务；</li>
</ol>
<h4 id="Fork-Join框架实战"><a href="#Fork-Join框架实战" class="headerlink" title="Fork/Join框架实战"></a>Fork/Join框架实战</h4><p>下面实现一个Fork/Join小例子，从1+2+…10亿，每个任务只能处理1000个数相加，超过1000个的自动分解成小任务并行处理；并展示了通过不使用Fork/Join和使用时的时间损耗对比。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br></pre></td><td class="code"><pre><span class="line">import java.util.concurrent.ForkJoinPool;</span><br><span class="line">import java.util.concurrent.RecursiveTask;</span><br><span class="line"></span><br><span class="line">public class ForkJoinTask extends RecursiveTask&lt;Long&gt; &#123;</span><br><span class="line"></span><br><span class="line">	private static final long MAX = 1000000000L;</span><br><span class="line">	private static final long THRESHOLD = 1000L;</span><br><span class="line">	private long start;</span><br><span class="line">	private long end;</span><br><span class="line"></span><br><span class="line">	public ForkJoinTask(long start, long end) &#123;</span><br><span class="line">		this.start = start;</span><br><span class="line">		this.end = end;</span><br><span class="line">	&#125;</span><br><span class="line"></span><br><span class="line">	public static void main(String[] args) &#123;</span><br><span class="line">		test();</span><br><span class="line">		System.out.println(&quot;--------------------&quot;);</span><br><span class="line">		testForkJoin();</span><br><span class="line">	&#125;</span><br><span class="line"></span><br><span class="line">	private static void test() &#123;</span><br><span class="line">		System.out.println(&quot;test&quot;);</span><br><span class="line">		long start = System.currentTimeMillis();</span><br><span class="line">		Long sum = 0L;</span><br><span class="line">		for (long i = 0L; i &lt;= MAX; i++) &#123;</span><br><span class="line">			sum += i;</span><br><span class="line">		&#125;</span><br><span class="line">		System.out.println(sum);</span><br><span class="line">		System.out.println(System.currentTimeMillis() - start + &quot;ms&quot;);</span><br><span class="line">	&#125;</span><br><span class="line"></span><br><span class="line">	private static void testForkJoin() &#123;</span><br><span class="line">		System.out.println(&quot;testForkJoin&quot;);</span><br><span class="line">		long start = System.currentTimeMillis();</span><br><span class="line">		ForkJoinPool forkJoinPool = new ForkJoinPool();</span><br><span class="line">		Long sum = forkJoinPool.invoke(new ForkJoinTask(1, MAX));</span><br><span class="line">		System.out.println(sum);</span><br><span class="line">		System.out.println(System.currentTimeMillis() - start + &quot;ms&quot;);</span><br><span class="line">	&#125;</span><br><span class="line"></span><br><span class="line">	@Override</span><br><span class="line">	protected Long compute() &#123;</span><br><span class="line">		long sum = 0;</span><br><span class="line">		if (end - start &lt;= THRESHOLD) &#123;</span><br><span class="line">			for (long i = start; i &lt;= end; i++) &#123;</span><br><span class="line">				sum += i;</span><br><span class="line">			&#125;</span><br><span class="line">			return sum;</span><br><span class="line">		&#125; else &#123;</span><br><span class="line">			long mid = (start + end) / 2;</span><br><span class="line"></span><br><span class="line">			ForkJoinTask task1 = new ForkJoinTask(start, mid);</span><br><span class="line">			task1.fork();</span><br><span class="line"></span><br><span class="line">			ForkJoinTask task2 = new ForkJoinTask(mid + 1, end);</span><br><span class="line">			task2.fork();</span><br><span class="line"></span><br><span class="line">			return task1.join() + task2.join();</span><br><span class="line">		&#125;</span><br><span class="line">	&#125;</span><br><span class="line"></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>这里需要计算结果，所以任务继承的是RecursiveTask类。ForkJoinTask需要实现compute方法，在这个方法里首先需要判断任务是否小于等于阈值1000，如果是就直接执行任务。否则分割成两个子任务，每个子任务在调用fork方法时，又会进入compute方法，看看当前子任务是否需要继续分割成孙任务，如果不需要继续分割，则执行当前子任务并返回结果。使用join方法会阻塞并等待子任务执行完并得到其结果。</p>
<p>程序输出：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">test</span><br><span class="line">500000000500000000</span><br><span class="line">4992ms</span><br><span class="line">--------------------</span><br><span class="line">testForkJoin</span><br><span class="line">500000000500000000</span><br><span class="line">508ms</span><br></pre></td></tr></table></figure>
<p>从结果看出，并行的时间损耗明显要少于串行的，这就是并行任务的好处。</p>
<p>尽管如此，在使用Fork/Join时也得注意，不要盲目使用。</p>
<ol>
<li>如果任务拆解的很深，系统内的线程数量堆积，导致系统性能性能严重下降；</li>
<li>如果函数的调用栈很深，会导致栈内存溢出；</li>
</ol>

        
        </div>
        <footer class="article-footer">
            <div class="share-container">



</div>

    <a data-url="http://youanyyou.gitee.io/javastack/2017/12/22/Java/thread/Java7任务并行执行神器：Fork&Join框架/" data-id="cjg4zd8sj00bkhg8ad7znq02e" class="article-share-link"><i class="fa fa-share"></i>分享到</a>
<script>
    (function ($) {
        // Prevent duplicate binding
        if (typeof(__SHARE_BUTTON_BINDED__) === 'undefined' || !__SHARE_BUTTON_BINDED__) {
            __SHARE_BUTTON_BINDED__ = true;
        } else {
            return;
        }
        $('body').on('click', function() {
            $('.article-share-box.on').removeClass('on');
        }).on('click', '.article-share-link', function(e) {
            e.stopPropagation();

            var $this = $(this),
                url = $this.attr('data-url'),
                encodedUrl = encodeURIComponent(url),
                id = 'article-share-box-' + $this.attr('data-id'),
                offset = $this.offset(),
                box;

            if ($('#' + id).length) {
                box = $('#' + id);

                if (box.hasClass('on')){
                    box.removeClass('on');
                    return;
                }
            } else {
                var html = [
                    '<div id="' + id + '" class="article-share-box">',
                        '<input class="article-share-input" value="' + url + '">',
                        '<div class="article-share-links">',
                            '<a href="https://twitter.com/intent/tweet?url=' + encodedUrl + '" class="fa fa-twitter article-share-twitter" target="_blank" title="Twitter"></a>',
                            '<a href="https://www.facebook.com/sharer.php?u=' + encodedUrl + '" class="fa fa-facebook article-share-facebook" target="_blank" title="Facebook"></a>',
                            '<a href="http://pinterest.com/pin/create/button/?url=' + encodedUrl + '" class="fa fa-pinterest article-share-pinterest" target="_blank" title="Pinterest"></a>',
                            '<a href="https://plus.google.com/share?url=' + encodedUrl + '" class="fa fa-google article-share-google" target="_blank" title="Google+"></a>',
                        '</div>',
                    '</div>'
                ].join('');

              box = $(html);

              $('body').append(box);
            }

            $('.article-share-box.on').hide();

            box.css({
                top: offset.top + 25,
                left: offset.left
            }).addClass('on');

        }).on('click', '.article-share-box', function (e) {
            e.stopPropagation();
        }).on('click', '.article-share-box-input', function () {
            $(this).select();
        }).on('click', '.article-share-box-link', function (e) {
            e.preventDefault();
            e.stopPropagation();

            window.open(this.href, 'article-share-box-window-' + Date.now(), 'width=500,height=450');
        });
    })(jQuery);
</script>

            
    

        </footer>
    </div>
    
        
<nav id="article-nav">
    
        <a href="/javastack/2017/12/22/arith/递归算法介绍及Java应用实战/" id="article-nav-newer" class="article-nav-link-wrap">
            <strong class="article-nav-caption">上一篇</strong>
            <div class="article-nav-title">
                
                    递归算法介绍及Java应用实战
                
            </div>
        </a>
    
    
        <a href="/javastack/2017/12/22/Java/Java父类强制转换子类原则/" id="article-nav-older" class="article-nav-link-wrap">
            <strong class="article-nav-caption">下一篇</strong>
            <div class="article-nav-title">Java父类强制转换子类原则</div>
        </a>
    
</nav>


    
</article>


    
    

</section>
            
                
<aside id="sidebar">
   
        
    <div class="widget-wrap">
        <h3 class="widget-title">分类</h3>
        <div class="widget">
            <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/javastack/categories/Java/">Java</a><span class="category-list-count">37</span><ul class="category-list-child"><li class="category-list-item"><a class="category-list-link" href="/javastack/categories/Java/多线程/">多线程</a><span class="category-list-count">3</span></li><li class="category-list-item"><a class="category-list-link" href="/javastack/categories/Java/新特性/">新特性</a><span class="category-list-count">10</span></li></ul></li><li class="category-list-item"><a class="category-list-link" href="/javastack/categories/Maven/">Maven</a><span class="category-list-count">4</span></li><li class="category-list-item"><a class="category-list-link" href="/javastack/categories/Mybatis/">Mybatis</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/javastack/categories/Netty/">Netty</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/javastack/categories/Tomcat/">Tomcat</a><span class="category-list-count">3</span></li><li class="category-list-item"><a class="category-list-link" href="/javastack/categories/书籍推荐/">书籍推荐</a><span class="category-list-count">6</span></li><li class="category-list-item"><a class="category-list-link" href="/javastack/categories/云计算/">云计算</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/javastack/categories/开源项目/">开源项目</a><span class="category-list-count">10</span></li><li class="category-list-item"><a class="category-list-link" href="/javastack/categories/测试/">测试</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/javastack/categories/漏洞/">漏洞</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/javastack/categories/程序人生/">程序人生</a><span class="category-list-count">3</span></li><li class="category-list-item"><a class="category-list-link" href="/javastack/categories/算法/">算法</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/javastack/categories/编程语言/">编程语言</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/javastack/categories/行业动态/">行业动态</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/javastack/categories/连接池/">连接池</a><span class="category-list-count">2</span></li></ul>
        </div>
    </div>

    
        
    <div class="widget-wrap">
        <h3 class="widget-title">技术栈</h3>
        <div class="widget tagcloud">
            <a href="/javastack/tags/CAT/" style="font-size: 10px;">CAT</a> <a href="/javastack/tags/Cobar/" style="font-size: 10px;">Cobar</a> <a href="/javastack/tags/Cookie/" style="font-size: 10px;">Cookie</a> <a href="/javastack/tags/Disconf/" style="font-size: 10px;">Disconf</a> <a href="/javastack/tags/Druid/" style="font-size: 12.86px;">Druid</a> <a href="/javastack/tags/Eclipse/" style="font-size: 10px;">Eclipse</a> <a href="/javastack/tags/Facebook/" style="font-size: 10px;">Facebook</a> <a href="/javastack/tags/IP/" style="font-size: 10px;">IP</a> <a href="/javastack/tags/IaaS/" style="font-size: 10px;">IaaS</a> <a href="/javastack/tags/JVM/" style="font-size: 10px;">JVM</a> <a href="/javastack/tags/Java/" style="font-size: 20px;">Java</a> <a href="/javastack/tags/Jodd/" style="font-size: 10px;">Jodd</a> <a href="/javastack/tags/Junit/" style="font-size: 10px;">Junit</a> <a href="/javastack/tags/Kotlin/" style="font-size: 10px;">Kotlin</a> <a href="/javastack/tags/LVS/" style="font-size: 10px;">LVS</a> <a href="/javastack/tags/Maven/" style="font-size: 14.29px;">Maven</a> <a href="/javastack/tags/Mybatis/" style="font-size: 10px;">Mybatis</a> <a href="/javastack/tags/NIO/" style="font-size: 10px;">NIO</a> <a href="/javastack/tags/Netty/" style="font-size: 10px;">Netty</a> <a href="/javastack/tags/Nginx/" style="font-size: 10px;">Nginx</a> <a href="/javastack/tags/Oracle/" style="font-size: 11.43px;">Oracle</a> <a href="/javastack/tags/PaaS/" style="font-size: 10px;">PaaS</a> <a href="/javastack/tags/Python/" style="font-size: 10px;">Python</a> <a href="/javastack/tags/SaaS/" style="font-size: 10px;">SaaS</a> <a href="/javastack/tags/Squid/" style="font-size: 10px;">Squid</a> <a href="/javastack/tags/Tengine/" style="font-size: 10px;">Tengine</a> <a href="/javastack/tags/Thrift/" style="font-size: 10px;">Thrift</a> <a href="/javastack/tags/Tomcat/" style="font-size: 12.86px;">Tomcat</a> <a href="/javastack/tags/https/" style="font-size: 10px;">https</a> <a href="/javastack/tags/jdk10/" style="font-size: 10px;">jdk10</a> <a href="/javastack/tags/jdk7/" style="font-size: 10px;">jdk7</a> <a href="/javastack/tags/jdk8/" style="font-size: 17.14px;">jdk8</a> <a href="/javastack/tags/jdk9/" style="font-size: 10px;">jdk9</a> <a href="/javastack/tags/书籍/" style="font-size: 15.71px;">书籍</a> <a href="/javastack/tags/云计算/" style="font-size: 10px;">云计算</a> <a href="/javastack/tags/代理/" style="font-size: 10px;">代理</a> <a href="/javastack/tags/分布式/" style="font-size: 11.43px;">分布式</a> <a href="/javastack/tags/区块链/" style="font-size: 10px;">区块链</a> <a href="/javastack/tags/多线程/" style="font-size: 12.86px;">多线程</a> <a href="/javastack/tags/安全/" style="font-size: 10px;">安全</a> <a href="/javastack/tags/开源项目/" style="font-size: 18.57px;">开源项目</a> <a href="/javastack/tags/性能优化/" style="font-size: 10px;">性能优化</a> <a href="/javastack/tags/攻击/" style="font-size: 10px;">攻击</a> <a href="/javastack/tags/数据库/" style="font-size: 10px;">数据库</a> <a href="/javastack/tags/架构师/" style="font-size: 11.43px;">架构师</a> <a href="/javastack/tags/测试/" style="font-size: 10px;">测试</a> <a href="/javastack/tags/漏洞/" style="font-size: 11.43px;">漏洞</a> <a href="/javastack/tags/监控/" style="font-size: 11.43px;">监控</a> <a href="/javastack/tags/程序人生/" style="font-size: 12.86px;">程序人生</a> <a href="/javastack/tags/算法/" style="font-size: 11.43px;">算法</a> <a href="/javastack/tags/缓存/" style="font-size: 10px;">缓存</a> <a href="/javastack/tags/编程语言/" style="font-size: 10px;">编程语言</a> <a href="/javastack/tags/腾讯/" style="font-size: 10px;">腾讯</a> <a href="/javastack/tags/行业动态/" style="font-size: 10px;">行业动态</a> <a href="/javastack/tags/负载均衡/" style="font-size: 11.43px;">负载均衡</a> <a href="/javastack/tags/连接池/" style="font-size: 12.86px;">连接池</a> <a href="/javastack/tags/阿里巴巴/" style="font-size: 14.29px;">阿里巴巴</a> <a href="/javastack/tags/高并发/" style="font-size: 10px;">高并发</a>
        </div>
    </div>

    
        
    <div class="widget-wrap widget-list">
        <h3 class="widget-title">链接</h3>
        <div class="widget">
            <ul>
                
                    <li>
                        <a href="http://hexo.io">Hexo</a>
                    </li>
                
            </ul>
        </div>
    </div>


    
    <div id="toTop" class="fa fa-angle-up"></div>
</aside>

            
        </div>
        <footer id="footer">
    <div class="outer">
        <div id="footer-info" class="inner">
            &copy; 2018 Java技术栈 版权所有
            <br>
            Powered by <a href="http://www.javastack.cn/" target="_self">javastack.cn</a>. 
        </div>
    </div>
</footer>
        


    
        <script src="/javastack/libs/lightgallery/js/lightgallery.min.js"></script>
        <script src="/javastack/libs/lightgallery/js/lg-thumbnail.min.js"></script>
        <script src="/javastack/libs/lightgallery/js/lg-pager.min.js"></script>
        <script src="/javastack/libs/lightgallery/js/lg-autoplay.min.js"></script>
        <script src="/javastack/libs/lightgallery/js/lg-fullscreen.min.js"></script>
        <script src="/javastack/libs/lightgallery/js/lg-zoom.min.js"></script>
        <script src="/javastack/libs/lightgallery/js/lg-hash.min.js"></script>
        <script src="/javastack/libs/lightgallery/js/lg-share.min.js"></script>
        <script src="/javastack/libs/lightgallery/js/lg-video.min.js"></script>
    
    
        <script src="/javastack/libs/justified-gallery/jquery.justifiedGallery.min.js"></script>
    
    



<!-- Custom Scripts -->
<script src="/javastack/js/main.js"></script>

    </div>
</body>
</html>